<?php
defined('InNcPHP') or exit('Access Invalid!');

/**
 * 固定价格门票sku
 * Class ticket_typeModel
 */
class ticket_sku_dateModel extends Model {

	public function __construct(){
		parent::__construct('ticket_sku_date');
	}

    /**
     * 获取某日价格门票所有sku信息
     * @param array $condition 日期ID
     * @return mixed
     */
    public function getTicketSkuList($condition = array())
    {
        return $this->table('ticket_sku_date,ticket_type')
            ->field('*')
            ->join('left')
            ->on('ticket_sku_date.type_id=ticket_type.type_id')
            ->where($condition)
            ->select();
    }

    /**
     * 获取某日价格门票所有规格信息
     * @param array $condition 日期ID
     * @return mixed
     */
    public function getTicketSpecSkuList($condition = array())
    {
        return $this->table('ticket_sku_date,spec')
            ->field('*')
            ->join('left')
            ->on('ticket_sku_date.spec_id=spec.spec_id')
            ->where($condition)
            ->select();
    }
    /**
     * 获取一条规格信息
     * @param array $condition
     * @return mixed
     */
    public function getTicketSpecSku($condition = array())
    {
        return $this->table('ticket_sku_date,spec')
            ->field('*')
            ->join('left')
            ->on('ticket_sku_date.spec_id=spec.spec_id')
            ->where($condition)
            ->find();
    }
    /**
     * 获取一条sku
     * @param array $condition
     * @return mixed
     */
    public function getTicketSku($condition = array())
    {
        return $this->table('ticket_sku_date,ticket_type')
            ->field('*')
            ->join('left')
            ->on('ticket_sku_date.type_id=ticket_type.type_id')
            ->where($condition)
            ->find();
    }

    /**
     * 要插入的值
     * @param array $params
     * @return mixed
     */
    public function addTicketSku($params)
    {
        return $this->table('ticket_sku_date')->insert($params);
    }

    /**
     * 更新sku
     * @param array $condition
     * @param array $params
     * @return mixed
     */
    public function updateTicketSku($condition, $params)
    {
        return $this->table('ticket_sku_date')->where($condition)->update($params);
    }

    /**
     * 删除sku
     * @param array $condition
     * @return mixed
     */
    public function delTicketSku($condition)
    {
        return $this->table('ticket_sku_date')->where($condition)->delete();
    }
}
?>

